package com.zmcc.service.impl;

import com.google.gson.Gson;
import com.zmcc.entity.TwoWayCallTemplate;
import com.zmcc.entity.common.CommonRequest;
import com.zmcc.service.ITwoWayCallRequest;

public class TwoWayCallRequestCommercial implements ITwoWayCallRequest {
    private final static String url = "https://dev.cmccopen.cn/api";

    private static TwoWayCallRequestCommercial twoWayCallRequestCommercial;

    public static synchronized TwoWayCallRequestCommercial getInstance() {
        if (twoWayCallRequestCommercial == null) {
            twoWayCallRequestCommercial = new TwoWayCallRequestCommercial();
        }
        return twoWayCallRequestCommercial;
    }

    @Override
    public CommonRequest getCallRequest(TwoWayCallTemplate template) {
        CommonRequest request = new CommonRequest();
        request.setUrl(url+"/v1" + "/voice" + "/twoWayCall");
        request.setBody(new Gson().toJson(template));
        return request;
    }
}
